<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	  layout:decorator="v2/layout">
<head>
	<title>欢迎进入管理系统</title>
	<script type="text/javascript" th:inline="javascript">
        var orgName = [[${session.user.name}]];
        var id = getParam("id");


        var export_execl = function(){
            location.href='list-detailApplyExportExecl?id='+id+'&beginAt='+(beginAt==null?'':beginAt)+'&endAt='+(endAt==null?'':endAt);
        }

        var updateApply = function(id, verify){
            var text = "";
            if(verify=='Pass'){
                text = "通过？";
            }else {
                text = "拒绝？";
            }
            $.jjconfirm({text:text,yes:function(){
                    $.ajaxData({url:"list-detailApplyVerify",type:"post",data:{id:id,verify:verify},success:function(){
                            $("#listPage").pageReload();
                        }});
                }});
        }

        $(function(){
            setMenu("报名管理-用户板式");

            $.ajaxData({url:"list-detailPassStatCount",data:{evaluateId:id},success:function(data){
                    data.bmCount = (data.bmCount==null?0:data.bmCount)
                    data.bmCountDay = (data.bmCountDay==null?0:data.bmCountDay)
                    data.waitCount = (data.waitCount==null?0:data.waitCount)
                    data.waitCountDay = (data.waitCountDay==null?0:data.waitCountDay)
                    data.passCount = (data.passCount==null?0:data.passCount)
                    data.passCountDay = (data.passCountDay==null?0:data.passCountDay)
                    $("#indexCount").loadData(data);
                }})


            $("#listPage").page({url:"list-detailPassList",data:{evaluateId:id}, success:function(ret){
                    $.each(ret.obj.content, function(i,v){
                        v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm");
                        v.successAt = new Date(v.successAt).Format("yyyy-MM-dd HH:mm");
                    });
                    $("#list").loadData({content:ret.obj.content,orgName:orgName});
                    $("span[data='look']").each(function(){
                        var text = $(this).attr("data-text");
                        if(text != ''){
                            var textHtml = "";
                            var textObj = eval("("+text+")");
                            $.each(textObj, function(i,v){
                                if(v.endWidth(".jpg") || v.endWidth(".png") || v.endWidth(".gif")){
                                    v = '<a href="'+v+'" target="_blank"><img src="'+v+'" width="50" height="50"/></a>';
                                }
                                textHtml += "<div>"+i+":"+v+"</div>";
                            });
                            $(this).jjinfo(textHtml);
                        }
                    });
                }});

        });
	</script>
	<style>

	</style>
</head>
<body>
<div layout:fragment="content">
	<div class="info info-full">
		<div class="stat">
			<div class="stat-top">
				<span class="stat-title"><strong>关键数据</strong></span>
			</div>
			<div class="stat-content">
				<script type="text/template" id="indexCount">
					<div class="stat-row" id="statCount">
						<div class="stat-group active">
							<div class="stat-group-title">已晋级</div>
							<div class="stat-group-count"><strong>#{passCount}#</strong></div>
							<div class="stat-group-day">
								<label>今日</label>
								<span>#{passCountDay}#</span>
							</div>
						</div>
						<div class="stat-group">
							<div class="stat-group-title">待定</div>
							<div class="stat-group-count"><strong>#{waitCount}#</strong></div>
							<div class="stat-group-day">
								<label>今日</label>
								<span>#{waitCountDay}#</span>
							</div>
						</div>
						<div class="stat-group">
							<div class="stat-group-title">报名人数</div>
							<div class="stat-group-count"><strong>#{bmCount}#</strong></div>
							<div class="stat-group-day">
								<label>今日</label>
								<span>#{bmCountDay}#</span>
							</div>
						</div>
					</div>
				</script>
			</div>

		</div>
	</div>

	<div class="c_tab">
		<ul class="c_tab-list" id="showType">
			<li data-state="user">用户板式</li>
			<li data-state="work">作品板式</li>
		</ul>
	</div>

	<div class="info info-full">
		<div class="detail-table">
			<h4 class="detail-table-title">
				详细数据
				<span class="detail-table-more">
							<a href="javascript:export_execl();"><i class="icon_export"></i>导出CSV</a>
						</span>
			</h4>
			<div class="table_list">
				<div class="table-overflow">
					<table class="table">
						<thead>
						<tr>
							<th>报名提交时间</th>
							<th>参赛编号</th>
							<th>类型</th>
							<th>用户（ID）</th>
							<th>姓名</th>
							<th>电话</th>
							<th>组别</th>
							<th>渠道</th>
							<th>报名信息</th>
							<th>票种</th>
							<th>评审状态</th>
							<th>作品</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<script type="text/template" id="list">
							#for(data:content)#
							<tr>
								<td>#{data.createdAt}#</td>
								<td>#{data.number}#</td>
								<td>#{data.typeDesc}#</td>
								<td>#{data.userName}# (#{data.userNumber}#)</td>
								<td>#{data.fullName}#</td>
								<td>#{data.phone}#</td>
								<td>#{data.groupName}#</td>
								<td>#{data.refName}#</td>
								<td><span data='look' data-text='#{data.text}#' class="table-icon table-icon-info"></span></td>
								<td>#{data.epName}#</td>
								<td>#{data.verifyStateDesc}#</td>
								<td><a href="list-detailPassInfo?evaluateApplyId=#{data.id}#">查看</a></td>
								<td>
									<div class="group-btn">
										#if(data.verifyState=='DD')#
										<a class="btn" href="javascript:updateApply(#{data.id}#,'Pass')">晋级</a>
										<a class="btn" href="javascript:updateApply(#{data.id}#,'NotPass')">待定</a>
										#endif#
									</div>
								</td>
							</tr>
							#endfor#
						</script>
						</tbody>
					</table>
					<div id="listPage"></div>
				</div>
			</div>
		</div>

	</div>

</div>
</body>
</html>